/* This do-file replicates table 2 of the paper */ 

cd "" /*input directory here with cleaned data appended_census_mothers using census preparation do-file*/

set more off 

use appended_census_mothers.dta, clear 

********************************************************************************
* Adjust Cohorts to match GHS, see text for detailed explanation * 

gen child_cohort_ghs=child_cohort
replace child_cohort_ghs=child_cohort+1 if yc_birth_month>=7

drop child_cohort 
rename child_cohort_ghs child_cohort 

********************************************************************************

*****************
* Sample Select *  
*****************
drop if race==3 | race==4 /* Exclude whites and Indian/Asian, who do not receive the CSG, see text */

* Select Windows * 

keep if child_cohort>=1987 & child_cohort<=1998


** Exclude missing values ** 

drop if emp==1 & (occupation==. | industry==.) &  (year==2001 | year==2007 | year==2011)
drop if emp==. | activity==.

replace yc_birth_month=99 if yc_birth_month==. /*Indicator variable if month of birth missing */

*********************************************************************************

*******************
* Functional Form *  
*******************

local f_form x  /* specify functional formal, x for linear, x x2 for quadratic */ 

gen x=child_cohort-1993
gen CSG=(x>=0)


* Cluster option ** 

gen cluster=household_id 

** Controls ** 

local controls i.race  age c.age#c.age yrs_schooling household_size i.province i.yc_birth_month



*******************
* Regressions     *  
*******************


quietly: reg activity `f_form'  c.(`f_form' )#CSG CSG  `controls' [w=weight] if year==2001 & married==1, cluster(cluster)
outreg2 using rdd_lt_01.tex, replace tex label alpha( 0.01, 0.05, 0.1) dec(4) keep(CSG)

quietly: reg unemployed `f_form'  c.(`f_form' )#CSG CSG  `controls' [w=weight] if year==2001 & married==1, cluster(cluster)
outreg2 using rdd_lt_01.tex, tex label alpha( 0.01, 0.05, 0.1) dec(4) keep(CSG) 

quietly: reg emp `f_form'  c.(`f_form' )#CSG CSG  `controls' [w=weight] if year==2001 & married==1, cluster(cluster) 
outreg2 using rdd_lt_01.tex, tex label alpha( 0.01, 0.05, 0.1) dec(4) keep(CSG)

quietly: reg activity `f_form'  c.(`f_form' )#CSG CSG  `controls' [w=weight] if year==2001 & married==0, cluster(cluster)
outreg2 using rdd_lt_01.tex, tex label alpha( 0.01, 0.05, 0.1) dec(4) keep(CSG)

quietly: reg unemployed `f_form'  c.(`f_form' )#CSG CSG  `controls' [w=weight] if year==2001 & married==0, cluster(cluster)
outreg2 using rdd_lt_01.tex, tex label alpha( 0.01, 0.05, 0.1) dec(4) keep(CSG) 
quietly: parmest, label list(parm p) level(95)  saving(2001unempum, replace)

quietly: reg emp `f_form'  c.(`f_form' )#CSG CSG  `controls' [w=weight] if year==2001 & married==0, cluster(cluster) 
outreg2 using rdd_lt_01.tex, tex label alpha( 0.01, 0.05, 0.1) dec(4) keep(CSG)



quietly: reg activity `f_form'  c.(`f_form' )#CSG CSG  `controls' [w=weight] if year==2007 & married==1, cluster(cluster)
outreg2 using rdd_lt_07.tex, replace tex label alpha( 0.01, 0.05, 0.1) dec(4) keep(CSG)

quietly: reg unemployed `f_form'  c.(`f_form' )#CSG CSG  `controls' [w=weight] if year==2007 & married==1, cluster(cluster)
outreg2 using rdd_lt_07.tex, tex label alpha( 0.01, 0.05, 0.1) dec(4) keep(CSG) 

quietly: reg emp `f_form'  c.(`f_form' )#CSG CSG  `controls' [w=weight] if year==2007 & married==1, cluster(cluster) 
outreg2 using rdd_lt_07.tex, tex label alpha( 0.01, 0.05, 0.1) dec(4) keep(CSG)

quietly: reg activity `f_form'  c.(`f_form' )#CSG CSG  `controls' [w=weight] if year==2007 & married==0, cluster(cluster)
outreg2 using rdd_lt_07.tex, tex label alpha( 0.01, 0.05, 0.1) dec(4) keep(CSG)

quietly: reg unemployed `f_form'  c.(`f_form' )#CSG CSG  `controls' [w=weight] if year==2007 & married==0, cluster(cluster)
outreg2 using rdd_lt_07.tex, tex label alpha( 0.01, 0.05, 0.1) dec(4) keep(CSG) 

quietly: reg emp `f_form'  c.(`f_form' )#CSG CSG  `controls' [w=weight] if year==2007 & married==0, cluster(cluster) 
outreg2 using rdd_lt_07.tex, tex label alpha( 0.01, 0.05, 0.1) dec(4) keep(CSG)


quietly: reg activity `f_form'  c.(`f_form' )#CSG CSG  `controls' [w=weight] if year==2011 & married==1, cluster(cluster)
outreg2 using rdd_lt_11.tex, replace tex label alpha( 0.01, 0.05, 0.1) dec(4) keep(CSG)

quietly: reg unemployed `f_form'  c.(`f_form' )#CSG CSG  `controls' [w=weight] if year==2011 & married==1, cluster(cluster)
outreg2 using rdd_lt_11.tex, tex label alpha( 0.01, 0.05, 0.1) dec(4) keep(CSG) 

quietly: reg emp `f_form'  c.(`f_form' )#CSG CSG  `controls' [w=weight] if year==2011 & married==1, cluster(cluster) 
outreg2 using rdd_lt_11.tex, tex label alpha( 0.01, 0.05, 0.1) dec(4) keep(CSG)

quietly: reg activity `f_form'  c.(`f_form' )#CSG CSG  `controls' [w=weight] if year==2011 & married==0, cluster(cluster)
outreg2 using rdd_lt_11.tex, tex label alpha( 0.01, 0.05, 0.1) dec(4) keep(CSG)

quietly: reg unemployed `f_form'  c.(`f_form' )#CSG CSG  `controls' [w=weight] if year==2011 & married==0, cluster(cluster)
outreg2 using rdd_lt_11.tex, tex label alpha( 0.01, 0.05, 0.1) dec(4) keep(CSG) 

quietly: reg emp `f_form'  c.(`f_form' )#CSG CSG  `controls' [w=weight] if year==2011 & married==0, cluster(cluster) 
outreg2 using rdd_lt_11.tex, tex label alpha( 0.01, 0.05, 0.1) dec(4) keep(CSG)



********************************************************************************


cap erase rdd_lt_01.tex
cap erase rdd_lt_01.txt

cap erase rdd_lt_07.tex
cap erase rdd_lt_07.txt

cap erase rdd_lt_11.tex
cap erase rdd_lt_11.txt
